﻿using System;
using System.Collections.Generic;
using BlobNet.Base.Collections.List;
using BlobNet.Base.Enums;
using BlobNet.Base.Interfaces;

namespace BlobNet.Base.DataProviders
{
    public interface IDataProvider 
    {
        #region Schema support

        void CreateSchema(Guid domainId);
        void RemoveSchema(Guid domainId);

        #endregion

        #region BlobPart

        void AddPropertyValue<TValue>(Guid domainId, Guid ownerId, string propertyName,
                                      PropertyValueType propertyValueType,string fullyQualifiedType,  TValue value);

        void UpdatePropertyValue<TValue>(Guid domainId, Guid ownerId, string propertyName,
                                         PropertyValueType propertyValueType, string fullyQualifiedType, TValue value);

        TValue RetrievePropertyValue<TValue>(Guid domainId, Guid ownerId, string propertyName);
        void RemovePropertyValues(Guid domainId, Guid entityId);

        #endregion

        #region List

        void AddEntityToCollection(Guid domainId, Guid collectionId, int position, string fullyQualifiedType,
                                   object value);

        void UpdateEntityToCollection(Guid domainId, Guid collectionId, int position, string fullyQualifiedType,
                                      object value);

        void RemoveEntityFromCollection(Guid domainId, Guid collectionId, int position);
        int GetCollectionCount(Guid domainId, Guid collectionId);
        void RemoveCollection(Guid domainId, Guid collectionId);
        IList<ITupleList> RetrieveListItems(Guid domainId, Guid collectionId);
        ITupleList RetrieveListItem(Guid domainId, Guid collectionId, int position);
        ITupleList RetrieveListItem(Guid domainId, Guid collectionId, Guid entityId);

        void CopyListRange(Guid domainId, Guid sourceCollectionId, Guid destinationCollectionId, int initialPosition,
                           int numItemsToCopy);

        #endregion

        bool EntityIsReferenced(Guid domainId, Guid entityId);
        bool HasPropertyValue(Guid domainId, Guid entityId,string propertyName);
        IEnumerable<string> RetrieveRegisteredProperties(Guid entityId, Guid guid);
        bool ExistsBlobDomain(Guid entityId);
        List<Guid> RetrieveItemsIds<TType>(Guid domainId);

    }
}